package com.cf.lock;


import com.cf.lock.core.LockService;
import com.cf.lock.core.ZDisLockAspect;
import com.cf.lock.core.ZLockProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * game-server-ZDisLockConfig
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/5/30 下午 03:01
 */
@Slf4j
@Configuration
@EnableConfigurationProperties(ZLockProperties.class)
public class ZDisLockConfig {

    //#####################锁服务###########################
    @Bean
    @ConditionalOnMissingBean(LockService.class)
    public LockService lockService() {
        log.info("实例化锁管理服务！");
        return new LockService();
    }


    //#####################锁切面###########################
    @Bean
    @ConditionalOnMissingBean(ZDisLockAspect.class)
    public ZDisLockAspect lockAspect() {
        log.info("实例化锁管理切面");
        return new ZDisLockAspect();
    }

}
